package cate.common.table.mall.sheet;

import cate.common.table.ESheet;
import cate.common.table.mall.row.MallConditionRow;

import java.util.ArrayList;
import java.util.List;

public class MallConditionSheet extends ESheet<MallConditionRow> {
    @Override
    public String getSheetName() {
        return "解锁条件";
    }

    public List<Integer> getConditionIds(List<Integer> excludeIds){
        List<Integer> list = new ArrayList<>();
        for(MallConditionRow row : getList()){
            if(row.conditionId > 0 && !excludeIds.contains(row.mallId)){
                list.add(row.id);
            }
        }
        return list;
    }

    public List<Integer> getConditionIdsByMallId(int mallId){
        List<Integer> list = new ArrayList<>();
        for(MallConditionRow row : getList()){
            if(row.conditionId > 0 && row.mallId == mallId){
                list.add(row.id);
            }
        }
        return list;
    }

    public boolean notExist(int mallId){
        return getConditionIdsByMallId(mallId).isEmpty();
    }
}
